import {INCREMENT} from './mutations-types.js'

export default {
  //方法
  // increment(state) {
  //   state.counter++
  // },
  [INCREMENT](state) {
    state.counter++
  },
  decrement(state) {
    state.counter--
  },
  incremenCount(state, payload) {
    // console.log(count)
    state.counter += payload.count
  },
  addStudent(state, stu) {
    state.students.push(stu)
  },
  updateInfo(state) {
    state.info.name = 'coderwhy'

    //错误代码：不能在这里进行异步操作
    // setTimeout(() => {
    //   state.infp.name = 'coderwhy'
    // }, 1000)

    // state.info['address'] = '洛杉矶'
    // Vue.set(state.info, 'address', '洛杉矶')
    //该方式做不到响应式
    // delete state.info.age
    // Vue.delete(state.info, 'age')
  }
}